home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / snmp / mib2c-data / generic-table-indexes-set.m2i < prev    next >
Encoding:
Text File  |  2007-02-07  |  4.0 KB  |  116 lines

  1. #############################################################  -*- c -*-
  2. ## generic include for XXX. Do not use directly.
  3. ##
  4. ## $Id: generic-table-indexes-set.m2i,v 1.9 2004/10/08 23:39:17 rstory Exp $
  5. ########################################################################
  6. @if $m2c_mark_boundary == 1@
  7. /** START code generated by $RCSfile: generic-table-indexes-set.m2i,v $ $Revision: 1.9 $ */
  8. @end@
  9. ########################################################################
  10. ##   memcpy((u_char*)&$node, ${node}_ptr, ${node}_len * sizeof(tbl_idx->${node}[0]));
  11. ##   tbl_idx->${node}_len = ${node}_len;
  12. ##
  13. @eval $gtis_tmp=""@
  14. @foreach $node index@
  15. @   include m2c_setup_node.m2i@
  16. @   eval $gtis_tmp="$gtis_tmp, $m2c_node_param_val"@
  17. @end@ # for each index
  18. ########################################################################
  19. ##//####################################################################
  20. ##//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  21. ##//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  22. @if $m2c_processing_type eq 'h'@
  23.  
  24. int ${context}_indexes_set_tbl_idx(${context}_mib_index *tbl_idx$gtis_tmp);
  25. int ${context}_indexes_set(${context}_rowreq_ctx *rowreq_ctx$gtis_tmp);
  26.  
  27. @end@ // m2c_processing_type eq 'h'
  28. ########################################################################
  29. ##//####################################################################
  30. ##//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  31. ##//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  32. @if $m2c_processing_type eq 'c'@
  33. /**
  34.  * set mib index(es)
  35.  *
  36.  * @param tbl_idx mib index structure
  37.  *
  38.  * @retval MFD_SUCCESS     : success.
  39.  * @retval MFD_ERROR       : other error.
  40.  *
  41.  * @remark
  42.  *  This convenience function is useful for setting all the MIB index
  43.  *  components with a single function call. It is assume that the C values
  44.  *  have already been mapped from their native/rawformat to the MIB format.
  45.  */
  46. int
  47. ${context}_indexes_set_tbl_idx(${context}_mib_index *tbl_idx$gtis_tmp)
  48. {
  49.     DEBUGMSGTL(("verbose:${context}:${context}_indexes_set_tbl_idx","called\n"));
  50.  
  51. @foreach $node index@
  52. @   include m2c_setup_node.m2i@
  53. ## table indexes are not allocated pointers, so do not allow realloc here
  54. @eval $m2c_node_realloc = 0@ // fail
  55.     /* $m2c_node_summary */
  56. @   eval $m2c_ctx_lh = "tbl_idx->$node"@
  57. @   eval $m2c_ctx_lhs = "tbl_idx->${node}_len"@
  58. @   eval $m2c_ctx_rh = "$m2c_node_param_val_name"@
  59. @   eval $m2c_ctx_rhs = "$m2c_node_param_val_lname"@
  60. @   if $m2c_node_needlength == 1@
  61.      $m2c_ctx_lhs = sizeof($m2c_ctx_lh);
  62. @   end@
  63. ## also, assume mapping already done
  64. @   include generic-ctx-get.m2i@
  65. ##@   include generic-value-map.m2i@
  66.     
  67. @end@ // for each column
  68.  
  69.     return MFD_SUCCESS;
  70. } /* ${context}_indexes_set_tbl_idx */
  71.  
  72. /**
  73.  * @internal
  74.  * set row context indexes
  75.  *
  76.  * @param reqreq_ctx the row context that needs updated indexes
  77.  *
  78.  * @retval MFD_SUCCESS     : success.
  79.  * @retval MFD_ERROR       : other error.
  80.  *
  81.  * @remark
  82.  *  This function sets the mib indexs, then updates the oid indexs
  83.  *  from the mib index.
  84.  */
  85. int
  86. ${context}_indexes_set(${context}_rowreq_ctx *rowreq_ctx$gtis_tmp)
  87. {
  88.     DEBUGMSGTL(("verbose:${context}:${context}_indexes_set","called\n"));
  89.  
  90.     if(MFD_SUCCESS != ${context}_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx
  91. @foreach $node index@
  92. @   include m2c_setup_node.m2i@
  93.                                    , $m2c_node_param_val_call
  94. @end@ # for each index
  95.            ))
  96.         return MFD_ERROR;
  97.  
  98.     /*
  99.      * convert mib index to oid index
  100.      */
  101.     rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
  102.     if(0 != ${context}_index_to_oid(&rowreq_ctx->oid_idx,
  103.                                     &rowreq_ctx->tbl_idx)) {
  104.         return MFD_ERROR;
  105.     }
  106.  
  107.     return MFD_SUCCESS;
  108. } /* ${context}_indexes_set */
  109.  
  110. @end@ // m2c_processing_type eq 'c'
  111. ##
  112. ########################################################################
  113. @if $m2c_mark_boundary == 1@
  114. /** END code generated by $RCSfile: generic-table-indexes-set.m2i,v $ $Revision: 1.9 $ */
  115. @end@
  116.